#include "QtCheckPoint.h"
#include <QPainter>
#include "QtBlendToEffect.h"
#include "QtSequentialAnimationEffect.h"
#include "QtScaleToEffect.h"
#include "QtRotateToEffect.h"


QtCheckPoint::QtCheckPoint(QtSprite *parent): QtCellSprite(parent), duration(1000)
{
	SetResource("foreground", "checkpoint");
}

QtCheckPoint::~QtCheckPoint()
{
}

void QtCheckPoint::Reached(void)
{
	QtSequentialAnimationEffect seq;

	QtScaleToEffect effect;

	effect.SetDuration(500);
	effect.SetTarget(this);
	effect.SetEndScale(Width()+20, Height()+20);

	seq.AddEffect(&effect);

	QtRotateToEffect effect1, effect2;

	effect1.SetDuration(300);
	effect1.SetTarget(this);
	effect1.SetEndAngle(Angle()-45);

	seq.AddEffect(&effect1);

	effect2.SetDuration(300);
	effect2.SetTarget(this);
	effect2.SetEndAngle(Angle()+45);

	seq.AddEffect(&effect2);
	seq.AddEffect(&effect1);
	seq.AddEffect(&effect2);


	effect1.SetDuration(300);
	effect1.SetTarget(this);
	effect1.SetEndAngle(Angle());

	seq.AddEffect(&effect1);

	effect.SetEndScale(Width(), Height());

	seq.AddEffect(&effect);

	AddEffect(&seq);

	Start();
}




